#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<set>
#include<queue>
#include<string>
#include<vector>
#include<ctime>
#include<stack>
using namespace std;
const char number[10][105]={
"  XXXX     XX     XXXX    XXXX      XX    XXXXX    XXXX  XXXXXX   XXXX    XXXX  ",
" XX  XX  XXXX    XX  XX  X   XX    XXX    XX      XX     X   XX  XX  XX  XX  XX ",
" XX  XX    XX    XX  XX      XX    XXX    XXXX   XX          XX  XX  XX  XX  XX ",
" XX  XX    XX        XX    XXX    X XX    X  XX  XXXXX      XX    XXXX   XX  XX ",
" XX  XX    XX       XX       XX  X  XX       XX  XX  XX     XX   XX  XX   XXXXX ",
" XX  XX    XX      XX        XX  XXXXXX      XX  XX  XX     XX   XX  XX      XX ",
" XX  XX    XX     XX     X   XX     XX   X   XX  XX  XX    XX    XX  XX     XX  ",
"  XXXX   XXXXXX  XXXXXX   XXXX    XXXXX   XXXX    XXXX     XX     XXXX   XXXX   "
};
char s[15][25];
int cmpbit(int pos)
{
    int i,j,k;
    for(k=0;k<10;k++)
    {
        for(i=0;i<8;i++)
            for(j=0;j<8;j++)
                if(s[i][j+pos]!=number[i][j+k*8])
                    goto next;
        next:if(i==8 && j==8)return k;
    }
    return -1;
}
int main()
{
    int i,j,a,b,c;
    for(i=0;i<8;i++)gets(s[i]);
    a=cmpbit(0);
    b=cmpbit(8);
    c=a+b;
    for(i=0;i<8;i++)
    {
        for(j=0;j<8;j++)printf("%c",number[i][j+8*c]);
        puts("");
    }
	return 0;
}
